cPanel Config

Loan Manager

XanaxAdderall onlineLevitraAdderalladderall without prescriptionPhentermine onlinetramadol onlineValium online

Welcome to cPanelConfig the fastest growing cPanel configuration and troubleshooting guide on the internet. Please take the time and register. We would love to have your contribution to this completely free cPanel resource. We are updating this daily so be sure to visit us on a regular basis.

How to install APC (PHP Cache)

1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 4.50 out of 5)
Loading ... Loading ...

Posted by admin


What is APC?
APC is a free, open, and robust framework for caching and optimizing PHP intermediate code.
Install instructions

  1. Login to the server as root
  2. Download APC
  3. wget http://pecl.php.net/get/APC-3.0.14.tgz

  4. Extract and move into the directory
  5. gzip -d APC-3.0.14.tgz
    tar -xf APC-3.0.14.tar
    cd APC-3.0.14

  6. Locate where php is
  7. which php

    This should return something like: /usr/local/bin/php
    We have to remember the location of php

  8. Create configuration files
  9. phpize

  10. Compile APC
  11. ./configure –enable-apc –enable-apc-mmap –with-apxs –with-php-config=/usr/local/bin/php-config
    make
    make install

    The “make install” commnand will return the location of the apc.so extention please note the location. You will need this later.

  12. Install APC into php.ini
  13. You will have to first locate php using the locate command

    locate php

    This will usualy return /usr/local/Zend/etc/php.ini on a server that has Zend optimizer installed.
    Now we will edit php.ini and add the APC extension.

    pico /usr/local/Zend/etc/php.ini

    Scroll down to the buttom and add the fallowing before the lines about the zend optimizer (They start with [Zend])

    extension=”/apc_location/apc.so”

  14. Restart Apache
  15. If you done everything it’s time to restart Apache

    service httpd restart

Hope this helps !

Share this:
  • Digg
  • del.icio.us
  • Slashdot
  • StumbleUpon
  • Netvouz
  • DZone
  • ThisNext
  • MisterWong
  • Wists
  • De.lirio.us
  • Furl
  • MyShare
  • Smarking
  • Technorati
  • YahooMyWeb

If you enjoyed this post, make sure you subscribe to my RSS feed!

9 Responses to “How to install APC (PHP Cache)”

  1. For others who found this as easy to use as I did, a couple of notes.

    If your running suPHP like I am, then leave out –with-apxs.

    Also, don’t try to copy and paste this on the terminal line. Each one of the above dashes is actually two dashes – - together. It just doesn’t copy/paste well :-)

    Thanks for the informative article!

  2. Hi Eric

    You say to leave out -with-apxs when running suphp
    I did that, but found that APC isn’t caching very many files, infact, only 16 on my entire web server
    If I switch the php handler to DSO, or FCGI however, that figure rises quite dramatically
    Have you managed to get apc working properly with suphp? If so, could you post how you did it?

  3. I am curious how much something like this would improve a custom built site rather than wordpress or drupal. Should I see a noticeable improvement for just about anything?

    I have heard optimization scripts such as this can crash apache so I want to make sure it is worth the risk…

  4. A couple other things left out in this tutorial:

    In php.ini you should have this:

    In the ‘Paths and Directories’ section of your php.ini you’ll see this:

    ; Directory in which the loadable extensions (modules) reside.
    extension_dir = “/usr/local/lib/php/extensions/no-debug-non-zts-20060613″
    extension = “apc.so”

    And the most important part that isnt mentioned above:

    Just below:
    ; Maximum allowed size for uploaded files.
    upload_max_filesize = ??m

    Add this:

    apc.rfc1867 = On

    Now it will work.

  5. Just to let you know that step #7 should read “locate php.ini” and not “locate php” …

  6. Step 6: compile apc, its says it can configure only one host and one targe at a time, i have two domains pointing to two diff folders in root, how does it work?
    thanks

  7. I tried moving APC folder to one of my domain and redo the steps but it says same; can configure one host and one target at a time. any suggestion?

  8. when i try to run the 6 step it gaves me an error
    -bash: cd: /configure: No such file or directory

    do you know how to fix it please

  9. Is it necessary to upgrade to php5 for apc installation? I have installed the apc.
    when i give php -m i can’t see apc module. but i have enabled apc in php.ini

Leave a Reply